<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" :close-on-press-escape="false" :close-on-click-modal="false">
    <el-form ref="form" :model="form" :rules="checkForm">
        <el-form-item prop="username" label="用户名" label-width="120px" required>
            <el-input v-model="form.username"></el-input>
        </el-form-item>
        <el-form-item prop="password" v-if="dialogTitle == '新增用户'" label="密码" label-width="120px" :rules="[{ required: true, message: '请输入密码', trigger: 'blur' }]">
            <el-input v-model="form.password" type="password"></el-input>
        </el-form-item>
        <el-form-item prop="age" label="年龄" label-width="120px">
            <el-input v-model="form.age"></el-input>
        </el-form-item>
        <el-form-item prop="roleIds" v-model="form.roleIds" label="角色" label-width="120px" :rules="[{ required: true, message: '请选择所属角色', trigger: 'change' }]">
            <el-select v-model="form.roleIds" multiple placeholder="请选择角色">
                <el-option
                        v-for="item in roleList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                </el-option>
            </el-select>
        </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="save('form')">确 定</el-button>
    </span>
</el-dialog>
